Politicians often use optimistic promises to win support, but their past actions reveal their true priorities. Instead of trusting words alone, look at their record — actions speak louder than words.
Casualties of War
Show Code
# List of African countries to excludeafrican_countries = ["Algeria", "Angola", "Benin", "Botswana", "Burkina Faso", "Burundi", "Cameroon", "Cape Verde","Central African Republic", "Chad", "Comoros", "Congo", "Djibouti", "Egypt", "Equatorial Guinea","Eritrea", "Eswatini", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea", "Guinea-Bissau","Ivory Coast", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar", "Malawi", "Mali","Mauritania", "Mauritius", "Morocco", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda","Sao Tome and Principe", "Senegal", "Seychelles", "Sierra Leone", "Somalia", "South Africa","South Sudan", "Sudan", "Tanzania", "Togo", "Tunisia", "Uganda", "Zambia", "Zimbabwe", "Democratic Republic of the Congo", "Côte d'Ivoire", "Democratic Republic of Congo"]# Load the CSV file and rename columnsdf = pl.read_csv("countries-in-conflict-data.csv").rename({"Entity": "country","Code": "country_code","Year": "year","Deaths in ongoing conflicts in a country (best estimate) - Conflict type: all": "total_deaths"}).select(["year", "country", "total_deaths"])# Ensure data types for consistencydf = df.with_columns([ pl.col("year").cast(pl.Int64), pl.col("total_deaths").cast(pl.Int64)])# Load the 2024 data and rename columnsdf_2024 = pl.read_csv("acled_aggregated_20024.csv").rename({"Country": "country","Fatalities": "total_deaths"})# Add a 'year' column with the value 2024 and ensure consistency in data typesdf_2024 = df_2024.with_columns([ pl.lit(2024).alias("year").cast(pl.Int64), pl.col("total_deaths").cast(pl.Int64)]).select(["year", "country", "total_deaths"])# Append the 2024 data to the main DataFramedf_combined = df.vstack(df_2024)# Remove any trailing or leading whitespace in the 'country' columndf_combined = df_combined.with_columns( pl.col("country").str.replace(r"^\s+|\s+$", "") # This regex removes leading and trailing whitespace)# Filter the DataFrame for years between 2001 and 2024, excluding African countriesdf_filtered = df_combined.filter( (pl.col("year") >=2001) & (pl.col("year") <=2024) & (~pl.col("country").is_in(african_countries)))# Sum up deaths per year across all non-African countriesdeaths_per_year = ( df_filtered.group_by("year") .agg(pl.col("total_deaths").sum().alias("Total Deaths")) .sort("year"))# Set up a nice stylesns.set_theme(style="whitegrid")# Plottingplt.figure(figsize=(11, 7))plt.plot(deaths_per_year["year"], deaths_per_year["Total Deaths"], marker='o', linestyle='-', color='#8B0000', linewidth=2) # Dark red color# Adding shaded regions for each presidencybush = plt.axvspan(2001, 2008, color='red', alpha=.5, label="Bush/Cheney")obama = plt.axvspan(2008, 2016, color='blue', alpha=.5, label="Obama/Biden")trump = plt.axvspan(2016, 2020, color='lightcoral', alpha=0.3, label="Trump/Pence")biden = plt.axvspan(2020, 2024, color='lightblue', alpha=0.3, label="Biden/Harris")# Adding data labels above the pointsfor x, y inzip(deaths_per_year["year"], deaths_per_year["Total Deaths"]): plt.text(x, y +max(deaths_per_year["Total Deaths"]) *0.02, f"{y:,}", ha="center", va="bottom", fontsize=11, weight='bold')# Titles and labelsplt.title("Total Deaths in Armed Conflicts (2001 - October 2024, Excluding Africa)", fontsize=16, weight='bold')plt.xlabel("Year", fontsize=12)plt.ylabel("Total Deaths", fontsize=12)# Format y-axis with commasplt.gca().yaxis.set_major_formatter(FuncFormatter(lambda x, _: f"{int(x):,}"))# Improving the x-axis ticksplt.xticks(deaths_per_year["year"], rotation=45)# Adding a subtle gridplt.grid(True, which='both', linestyle='--', linewidth=0.5, alpha=0.7)# First legend for presidential terms (upper left), excluding the election linesfirst_legend = plt.legend(handles=[bush, obama, trump, biden], loc="upper left", fontsize=10, title="Presidential Terms")plt.gca().add_artist(first_legend)# Show plotplt.tight_layout()plt.show()